package cn.jasonone.vo;

import java.util.List;
import java.util.Objects;

public class PageInfo<T> {
	private Integer page;
	private Integer pageSize;
	private Integer total;
	private List<T> list;

	public PageInfo(Integer page, Integer pageSize) {
		super();
		this.page = page;
		this.pageSize = pageSize;
	}

	public PageInfo(Integer page, Integer pageSize, Integer total, List<T> list) {
		super();
		this.page = page;
		this.pageSize = pageSize;
		this.total = total;
		this.list = list;
	}

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getTotal() {
		return total;
	}

	public void setTotal(Integer total) {
		this.total = total;
	}

	public List<T> getList() {
		return list;
	}

	public void setList(List<T> list) {
		this.list = list;
	}

	@Override
	public int hashCode() {
		return Objects.hash(list, page, pageSize, total);
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PageInfo other = (PageInfo) obj;
		return Objects.equals(list, other.list) && Objects.equals(page, other.page)
				&& Objects.equals(pageSize, other.pageSize) && Objects.equals(total, other.total);
	}

	@Override
	public String toString() {
		return "{\"page\":" + page + ", \"pageSize\":" + pageSize + ", \"total\":" + total + ", \"list\":" + list + "}";
	}

}
